<template>
    <div>
        <template v-for="(item, index) in list">
            <template v-if="values?.includes(item.dict_value)">
                <a-tag :key="item.id" :index="index" :color="item.dict_color">
                    {{ item.dict_label }}{{ extra }}
                </a-tag>
            </template>
        </template>
    </div>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
const props = defineProps({
    list: {
        type: Array<any>,
        default: []
    },
    value: {
        type: [Number, String, Array, Boolean],
        default: ''
    },
    extra: {
        type: String,
        default: ''
    }
});
let values = ref<any>();

onMounted(() => {
    if (props.value !== null && typeof props.value !== 'undefined') {
        values.value = Array.isArray(props.value) ? props.value : [props.value];
    } else {
        values.value = [];
    }
})
</script>
<style scoped>
.a-tag+.a-tag {
    margin-left: 10px;
}
</style>
